package rpg.visual.menu;

import java.awt.Graphics2D;
import java.awt.event.MouseEvent;

import pgui.PVisual;
import pgui.visual.PComponent;
import rpg.map.Map;
import rpg.visual.menu.item.VisualMenuSettings;
import rpg.visual.menu.item.VisualMenuStatus;
import square.data.MapData;

public class VisualMenu extends PComponent {
	private Map map;

	// Menu
	private VisualMenuItem status, settings;

	// Skill
	private VisualMenuSkills skills;

	// Creation
	public VisualMenu(PVisual visual) {
		super(visual);

		this.setRelativeWidth(100);

		this.setHeight(40);
		this.setRelativeY(100);
		this.setY(-this.getHeight());

		this.setColor(35, 30, 0);
		this.setOpacity(7);

		// Status
		status = new VisualMenuStatus(visual);
		this.addChild(status);

		// Settings
		settings = new VisualMenuSettings(visual);
		settings.setX(44);
		this.addChild(settings);

		// Skills
		skills = new VisualMenuSkills(visual);
		skills.setRelativeX(100);
		this.addChild(skills);
	}

	// Mouse Events
	@Override
	public void onMouseEntered(MouseEvent event) {
		super.onMouseEntered(event);
		this.setY(-this.getHeight());
	}

	@Override
	public void onMouseExited(MouseEvent event, MouseEvent lastEvent) {
		super.onMouseExited(event, lastEvent);
	}

	// Paint Events
	@Override
	public void onPaint(Graphics2D g) {
		super.onPaint(g);

		g.fillRect(0, 0, this.getLastWidth(), this.getLastHeight());
	}

	// Get & Set
	public Map getMap() {
		return map;
	}

	public void setMap(MapData map) {
		this.map = (Map) map;
	}

	public VisualMenuItem getStatus() {
		return status;
	}

	public void setStatus(VisualMenuItem status) {
		this.status = status;
	}

	public VisualMenuItem getSettings() {
		return settings;
	}

	public void setSettings(VisualMenuItem settings) {
		this.settings = settings;
	}

	public VisualMenuSkills getSkills() {
		return skills;
	}

	public void setSkills(VisualMenuSkills skills) {
		this.skills = skills;
	}
}
